﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
//参照实例4 .3，设计一个矩形类（Rect)与一个圆类(Circle)，定义面积为只读属性。
namespace _4._3
{
    class Rect
    {
        private int length;
        private int width;
        public int Length
        {
            get {return length; }
            set { length = value; }
        }
        public int Width
        {
            get { return width; }
            set { width = value; }
        }
        public int Area
        {
            get { return length*width; }
        }
    }
    class Circle
    {
        private int length;
        private int width;
        public int Length
        {
            get { return length; }
            set { length = value; }
        }
        public int Width
        {
            get { return width; }
            set { width = value; }
        }
        public int Area
        {
            get { return length*width; }
        }
    }


    class Program
    {
        static void Main(string[] args)
        {
            Rect r = new Rect();
            r.Length = 10;
            r.Width = 20;
            Circle c = new Circle();
            c.Length = 10;
            c.Width = 30;
            Console.WriteLine("矩形：长：{0},宽：{1},面积：{2}",r.Length,r.Width,r.Area);
            Console.WriteLine("圆形：长：{0},宽：{1},面积：{2}", c.Length, c.Width, c.Area);
            Console.ReadKey();
        }
    }
}
